package bbs.mappers;

import bbs.entity.dto.MapDto;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 文章信息 数据库操作接口
 */
public interface ForumArticleMapper<T,P> extends BaseMapper<T,P> {

	/**
	 * 根据ArticleId更新
	 */
	 Integer updateByArticleId(@Param("bean") T t,@Param("articleId") String articleId);


	/**
	 * 根据ArticleId删除
	 */
	 Integer deleteByArticleId(@Param("articleId") String articleId);


	/**
	 * 根据ArticleId获取对象
	 */
	 T selectByArticleId(@Param("articleId") String articleId);

	 void updateArticleCount(@Param("articleId") String articleId,@Param("updateType") Integer updateType,@Param("changeCount") Integer changeCount);

	 void updateBoardNameBatch(@Param("boardType") Integer boardType, @Param("boardName") String name,@Param("boardId") Integer boardId);

	 void updateStatusBatchByUserId(@Param("status") Integer status, @Param("userId") String userId);

	/**
	 * 统计地区帖子
	 * @return
	 */
	@Select("select user_ip_address as area, count(1) as count from forum_article group by user_ip_address")
	List<MapDto> articleAreaCount();
}
